/* 组织-基础设置api */

import { ajaxService } from '@/utils/request';

const env = import.meta.env;
// const baseURL = env.VITE_API_BASE_URL;
const baseURL = env.VITE_DEV_BASE_URL;
const baseURL2 = env.VITE_DEV_BASE_URL;
// 获取职务类别
export function GetJobTypeList(params?: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/position_system/job_category',
    // url: '/organization/position/set/sort',
    method: 'get',
    baseURL,
    params
  });
}

// 获取职务级别
export function GetJobLevelList(params?: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/position_system/job_level',
    method: 'get',
    baseURL,
    params
  });
}

// 获取职位类别
export function GetPositionTypeList(params?: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/position_system/position_category',
    method: 'get',
    baseURL: baseURL2,
    params
  });
}
// 新增职位类别
export function PostPositionTypeList(data: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/position_system/position_category',
    method: 'post',
    baseURL,
    data
  });
}

// 获取职位层级
export function GetPositionLevelList(params?: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/position_system/position_level',
    method: 'get',
    baseURL: baseURL2,
    params
  });
}

// 获取职位层级
export function PostPositionLevelList(data: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/position_system/position_level',
    method: 'post',
    baseURL,
    data
  });
}

// 编辑职位层级
export function PutPositionLevelList(data: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/position_system/position_level',
    method: 'pust',
    baseURL,
    data
  });
}

// 获取职位层级
export function DelPositionLevelList(params: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/position_system/position_level',
    method: 'delete',
    baseURL,
    params
  });
}

// 获取工作地点类型
export function GetWorkTypeList(params: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/organizational_settings/work_location_type',
    method: 'get',
    baseURL,
    params
  });
}

// 新增工作地点类型
export function PostWorkTypeList(data: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/organizational_settings/work_location_type',
    method: 'post',
    baseURL,
    data,
    isLoading: true
  });
}

// 修改工作地点类型
export function PutWorkTypeList(data: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/organizational_settings/work_location_type',
    method: 'put',
    baseURL,
    data,
    isLoading: true
  });
}

// 获取工作地点类型
export function DelWorkTypeList(data: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/organizational_settings/work_location_type',
    method: 'delete',
    baseURL,
    data
  });
}

// 获取工作地点类型
export function CheckWorkTypeList(params: any) {
  return ajaxService({
    url: '/hr/organization/basic_setting/organizational_settings/legal_entity_type/repeat',
    method: 'get',
    baseURL,
    params
  });
}

// 引用组织模板库
export function PostReferenceOrganizationTemplate(data: {
  ownerId: number; // 组织类型
  ids: number[];
}) {
  return ajaxService({
    url: '/hr/organization/template/copy',
    method: 'post',
    baseURL,
    data,
    isLoading: true
  });
}

// 引用职位说明书
export function PostReferencePositionTemplate(data: {
  ownerId: number; // 职位类型
  ids: number[];
}) {
  return ajaxService({
    url: '/hr/organization/template/copy/p',
    method: 'post',
    baseURL,
    data,
    isLoading: true
  });
}
